# 列表
list_01 = []
number = [1,2,3,4,5]
animal = ["elephant","monkey"]
list_02 = [1,2,3,"aaa","bbb",[8,9],()]
# print(list_02)
# list_02[1] = "num"
# print(list_02)

# 遍历
# while循环
# i = 0
# while i < len(list_02):
#     print(list_02[i])
#     i += 1
# for循环
# for i in list_02:
#     print(i)

# 添加元素
# append
# print(list_01)
# list_01.append(1)
# list_01.append("hello")
# print(list_01)
# list_01.extend(animal)
# print(list_01)
# list_01.insert(2,"555")  # 2表示索引2,555是加进去的元素值
# print(list_01)

# 删除元素
# del
# del list_01[1]
# print(list_01)
# del list_01[1:]
# print(list_01)
# del list_01[1:4]
# print(list_01)
# pop
# list_01.pop()
# print(list_01)
# remove
# list_01.remove("hello")
# print(list_01)

# 分片赋值
# list_03 = [1,2,3,"aaa","bbb"]
# print(list_03)
# list_03[2:] = [4,5,6]
# print(list_03)
# list_03[1:] = []
# print(list_03)
# list_03[1:1] = [7,8,9]
# print(list_03)

# 排序
list_04 = [1,56,89,45,34,51,78,65,31,0.2]
print(list_04)
# list_04.reverse()
# print(list_04)
# list_04.sort()
# print(list_04)
# list_04.sort(reverse=True)
# print(list_04)
list_05 = sorted(list_04)
print(list_04)
print(list_05)

